<template>
    <div class="app-container">
      <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="110px">
        <el-form-item label="订单编号" prop="orderNo">
          <el-input v-model="queryParams.orderNo" placeholder="请输入订单编号" clearable size="small"
            @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="用户名" prop="fuwuPerson">
          <el-input v-model="queryParams.fuwuPerson" placeholder="请输入用户名" clearable size="small"
            @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="用户电话" prop="fuwuPhone">
          <el-input v-model="queryParams.fuwuPhone" placeholder="请输入用户电话" clearable size="small"
            @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item>
          <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
          <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
        </el-form-item>
      </el-form>
      <el-table v-loading="loading" :data="tabList">
        <el-table-column label="订单编号" align="center" prop="orderNo" />
        <el-table-column label="用户名" align="center" prop="fuwuPerson" />
        <el-table-column label="用户电话" align="center" prop="fuwuPhone" />
        <el-table-column label="报备时间" align="center" prop="reportTime" />
        <el-table-column label="报备描述" align="center" prop="reportDesc">
          <template slot-scope="scope">
            <div @click="lookReport(scope.row)" style="color:cornflowerblue;cursor: pointer;">查看</div>
          </template>
        </el-table-column>
        <el-table-column label="证明材料" align="center" prop="reportImgUrl">
          <template slot-scope="scope">
            <div @click="imgUrlClick(scope.row)" style="color:cornflowerblue;cursor: pointer;">查看</div>
          </template>
        </el-table-column>
      </el-table>
      <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
      <el-dialog title="报备描诉" :close-on-click-modal="false" :visible.sync="reportOpen" width="500px" append-to-body >
        <div class="reportCont">{{ reportDesc }}</div>
        <div slot="footer" class="quesEditBtn">
          <el-button @click="cancel">取 消</el-button>
        </div>
    </el-dialog>
    <el-dialog :visible.sync="picShow" title="证明材料">
      <el-image style="width: 100px; height: 100px;margin:0 10px 10px 0" :src="url.url"  v-for="url in srcList" :preview-src-list="[url.url]"> </el-image>
    </el-dialog>
    </div>
  </template>
    
  <script>
  import { reportList} from "@/api/jishiManage/jishi";
  export default {
    name: "Knowledge",
    components: {
    },
    data() {
      return {
        // 遮罩层
        loading: false,
        // 显示搜索条件
        showSearch: true,
        // 总条数
        total: 0,
        // 选中数组
        ids: [],
        // 非单个禁用
        single: true,
        // 非多个禁用
        multiple: true,
        // 表格数据
        tabList: [],
        // 弹出层标题
        title: "",
        // 是否显示弹出层
        open: false,
        reportOpen:false,
        picShow:false,
        companyTypeOptions: [],
        // 查询参数
        queryParams: {
          pageNum: 1,
          pageSize: 10,
          orderNo:null,
          fuwuPerson:null,
          fuwuPhone:null,
        },
        reportDesc:'',//报备描述
        srcList:[]
      };
    },
    created() {
      this.getList();
      //在字典查询-区县
      this.getDicts("user_area").then(response => {
        this.userAreaArray = response.data;
      });
    },
    methods: {
      /** 搜索按钮操作 */
      handleQuery() {
        this.queryParams.pageNum = 1;
        this.getList();
      },
      /** 重置按钮操作 */
      resetQuery() {
        this.resetForm("queryForm");
        this.handleQuery();
      },
      /** 查询产品入库列表 */
      getList() {
        this.loading = true;
        reportList(this.queryParams).then(response => {
          this.tabList = response.rows;
          this.total = response.total;
          this.loading = false;
        });
      },
      lookReport(row){
        const id = row.id;
        this.reportDesc = row.reportDesc;
        this.reportOpen = true
      },
      cancel(){
        this.reportOpen = false
      },
      imgUrlClick(row){
        this.srcList = []
        if (row.reportImgUrl) {
            this.srcList = JSON.parse(row.reportImgUrl);
        }
        this.picShow = true
      }
    }
  };
  </script>
  <style>
    .reportCont{
      padding: 10px;
      min-height: 100px;
      border:1px solid #999;
      border-radius: 4px;
      font-size: 16px;
      color:#333;
      text-align: left;
    }
    .quesEditBtn{
      display: block;
      text-align: center;
    }
  </style>
    